1. Field of the Invention
The present invention relates to an analog-to-digital (A/D) converter which can be incorporated into a one-chip microcomputer, for converting analog signals into digital signals.
2. Description of the Prior Art
Referring now to FIG. 7, there is illustrated a block diagram showing the structure of a 16-bit one-chip microcomputer 110. In the figure, reference numeral 111 denotes a CPU, 112 denotes a RAM, 113 denotes a direct memory access controller (DMAC), 101 denotes an analog-to-digital (A/D) converter, and 114 denotes an external bus for interconnecting the CPU 111, the RAM 112, the DMAC 113, and the A/D converter 101. Referring next to FIG. 8, there is illustrated a block diagram showing the structure of the A/D converter 101. In the figure, reference numeral 102 denotes a comparator, 103 denotes an A/D conversion control circuit, 104 denotes an m-bit (e.g., 10-bit) data register for storing a conversion result, 105 denotes a digital-to-analog (D/A) converter, and 106 denotes an input terminal to which analog signals to be converted are applied.
A few kinds of analog-to-digital conversion methods each using a specific algorithm have been used. Hereinafter, a description will be made as to the successive approximation conversion method which is widely used for microcomputers or the like, as an example. In operation, an analog signal to be converted which is applied to the input terminal 106 is input to one input terminal of the comparator 102 and simultaneously a reference voltage Vref from the D/A converter 105 is input to the other input terminal of the comparator 102.
The comparator 102 then compares the input signal with the reference voltage Vref and then furnishes an output signal indicating the comparison result to the data register 104, under control of the A/D conversion control circuit 103. The value of the output signal is stored into the data register 104 as one bit of a digital signal which is the A/D conversion result of the input signal. At the completion of the bit conversion operation, the value stored in the data register 104 is delivered to the D/A converter 105 and is then digital-to-analog converted, so that the reference voltage Vref having a value different from the previous value is generated and is then furnished to the other input terminal of the comparator 102. The comparator 102 then compares the input signal applied to the input terminal with the reference voltage Vref having the new value and furnishes the output signal indicating the comparison result to the data register 104. The value of the output signal is then stored in the data register 104 as another bit of the digital signal. Such the bit conversion operation is repeated so that all bits (e.g., ten bits) are obtained as the A/D conversion result.
The prior art A/D converter which is so constructed as mentioned above thus provides all the bits, e.g., all of the ten bits as the A/D conversion result. Therefore, when using the prior art A/D converter with 10-bit resolution as shown in FIG. 8 to carry out a control operation which does not need an accuracy of 10bits, the steps of transferring the conversion result from the data register 104 to the RAM 112 shown in FIG. 7 and shifting the conversion result to generate an n-bit, e.g., 8-bit, data. On the other hand, 16-bit one-chip microcomputers handle data in a byte or 16 bits batch. Therefore, A/D converters with 10-bit resolution, which can be incorporated into a 16-bit one-chip microcomputer, have to transfer a 10-bit conversion result in a first byte batch including the two highmost or lowermost bits of the conversion result and in a second byte batch including the remaining 8 bits of the conversion result separately. Thus 10-bit A/D converters have to handle byte data including needless 6-bit data.
To this end, one-chip microcomputers including such a prior art 10-bit A/D converter need to transfer and shift data by means of the CPU 111, DMAC 113, or the like. Such a sequence of transferring and shifting operations can occupy the external bus 114. This results in reducing the real time processing capability of one-chip microcomputers including a prior art A/D converter. Furthermore, a memory area of 16 bits is needed in order to store one 10-bit conversion result in the RAM 112. This results in reducing available memory space in the RAM 112.
Although prior art 10-bit A/D converters can include a built-in additional circuit for selecting either an 8-bit A/D conversion result or a 10-bit A/D conversion result according to a value written into a mode register, such prior art A/D converters have drawbacks that the mode register must be set before starting an A/D conversion operation and both 10-bit and 8-bit conversion results cannot be obtained simultaneously.